import pygame

class Container:
    """base class for containers"""
    def __init__(self):
        """init container"""
        self.widgets=[]
        pygame.init()
    
    def Add(self,widget):
        """add widget to container"""
        self.widgets.append(widget)
        
    def Remove(self,widget):
        """remove widget from container"""
        self.widgets.remove(widget)
    
    def Redraw(self,screen):
        """redraw container by draw all widgets inside"""
        for w in self.widgets:
            w.Draw(screen)
    
    def PollEvent(self,event):
        """send event to all widgets inside"""
        for w in self.widgets:
            w.Update(event)
            w.Event(event)
